package start.spring.basic.exception.common;

/**
 * ****************************************************************************
 * 公共未知异常
 *
 * @author(作者)：xuyongyun	
 * @author(复审人)：	Administrator 2018年8月22日
 * @version(版本)1.0
 * @since 1.0
 ******************************************************************************
 */
public class CommonException extends RuntimeException implements ExceptionInterface {

	private static final long serialVersionUID = -5943790039872607007L;
	
	private String errcode = "4000";
	
	private boolean isReturnMsg = false;
	
	public CommonException() {
		super();
	}
	
	public CommonException(String errmsg) {
		super(errmsg);
	}
	public CommonException(String errmsg,boolean isReturnMsg) {
		super(errmsg);
		this.setReturnMsg(isReturnMsg);
	}
	
	public CommonException(String errmsg,Throwable cause) {
		super(errmsg,cause);
	}
	public CommonException(String errmsg,Throwable cause,boolean isReturnMsg) {
		super(errmsg,cause);
		this.setReturnMsg(isReturnMsg);
	}
	
	public CommonException(String errcode,String errmsg) {
		super(errmsg);
		this.setErrcode(errcode);
	}
	public CommonException(String errcode,String errmsg,boolean isReturnMsg) {
		super(errmsg);
		this.setErrcode(errcode);
		this.setReturnMsg(isReturnMsg);
	}
	
	public CommonException(String errcode,String errmsg,Throwable cause) {
		super(errmsg,cause);
		this.setErrcode(errcode);
	}
	public CommonException(String errcode,String errmsg,Throwable cause,boolean isReturnMsg) {
		super(errmsg,cause);
		this.setErrcode(errcode);
		this.setReturnMsg(isReturnMsg);
	}

	@Override
	public String getErrcode() {
		return errcode;
	}

	public void setErrcode(String errcode) {
		this.errcode = errcode;
	}

	@Override
	public boolean isReturnMsg() {
		return isReturnMsg;
	}

	public void setReturnMsg(boolean isReturnMsg) {
		this.isReturnMsg = isReturnMsg;
	}
}
